package com.java.yz.day15.factorydemo2;

import com.java.yz.day15.factorydemo1.Animal;

//工厂方法模式:每一个动物独立一个工厂
public class AnimalText1 {
    public static void main(String[] args) {

        //这样就成功创建了一只狗
        DogFactory factory = new DogFactory();
        Animal animal = factory.getAnimal();
        animal.eat();
        animal.sleep();
    }
}
